Skip to content

HTTPD default 8Kb header limit check, to avoid 500 Internal Server Error #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2019

Conversation

hopeseekr
Copy link
Member

@hopeseekr hopeseekr commented May 15, 2019

From ccampbell/chromephp#63:

The HTTP spec does not define a limit, however many servers do by
default:
Apache 2.0, 2.2: 8K
nginx: 4K - 8K
IIS: varies by version, 8K - 16K
Tomcat: varies by version, 8K - 48K(?!)

Ans it is not just with ChormePHP.
Some user agents and some requests just get too big for web server
defaults.
It seems like a silly problem to run into, but it keeps happening.

Also:

  • Modern code formatting.

Merges ccampbell/chromephp#63, addresses ccampbell/chromephp#40 and ccampbell/chromephp#65.


This change is Reviewable

dulldusk and others added 2 commits May 14, 2017 04:11
The HTTP spec does not define a limit, however many servers do by
default:
Apache 2.0, 2.2: 8K
nginx: 4K - 8K
IIS: varies by version, 8K - 16K
Tomcat: varies by version, 8K - 48K(?!)

Ans it is not just with ChormePHP.
Some user agents and some requests just get too big for web server
defaults.
It seems like a silly problem to run into, but it keeps happening.
@hopeseekr hopeseekr changed the title Dulldusk master HTTPD default 8Kb header limit check, to avoid 500 Internal Server Error May 15, 2019
@hopeseekr hopeseekr merged commit 0ac6ec5 into master May 15, 2019
@hopeseekr hopeseekr deleted the dulldusk_master branch May 15, 2019 05:18
header($header);
}

protected function _formatSize($arg) {
Copy link
Collaborator

@peter279k peter279k May 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this method coding style is not same as other methods.

To be consistency, I think we should fix/organize coding style and I suggest we can follow the PSR-2 coding style :).

And the PHP_CodeSniffer is one of coding style check tool we can consider.

if ($arg > 0) {
$j = 0;
$ext = ["bytes","Kb","Mb","Gb","Tb"];
while ($arg >= pow(1024, $j)) ++$j; {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the while loop usage syntax is good.

We should make this while syntax be readable if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants